package com.example.ytc.clazz;

import java.io.IOException;
import java.io.Serializable;
import java.net.MalformedURLException;
import java.net.URL;

import android.graphics.Bitmap;
import android.graphics.BitmapFactory;

public class Video implements Serializable {

	private static final long serialVersionUID = 1L;
	public String Yt_id;
	public String Titel;
	public String image_url;
	public String description;
	public String url_toplay;
	public int duration;
	private Bitmap image;

	public Bitmap getImage() {
		return image;
	}

	public Video(String yt_id, String titel, String image, String description,
			String url_toplay, int duration)  {
		super();
		Yt_id = yt_id;
		Titel = titel;
		this.image_url = image;
		this.description = description;
		this.url_toplay = url_toplay;
		this.duration = duration;
		
	}

	public String getYt_id() {
		return Yt_id;
	}

	public void setimage()  {
		URL url1 = null;
		try {
			url1 = new URL(this.image_url);
		} catch (MalformedURLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		try {
			image = BitmapFactory.decodeStream(url1.openConnection()
					.getInputStream());
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
	}

	public void setYt_id(String yt_id) {
		Yt_id = yt_id;
	}

	public String getTitel() {
		return Titel;
	}

	public void setTitel(String titel) {
		Titel = titel;
	}

	public String getImage_url() {
		return image_url;
	}

	public void setImage_url(String image_url) {
		this.image_url = image_url;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public String getUrl_toplay() {
		return url_toplay;
	}

	public void setUrl_toplay(String url_toplay) {
		this.url_toplay = url_toplay;
	}

	public int getDuration() {
		return duration;
	}

	public void setDuration(int duration) {
		this.duration = duration;
	}
	public Ivideo getIvide(){
		return new Ivideo(this);
	}
}
